package com.atguigu.crowd.api;


import atguigu.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Service
@FeignClient("nacos-redis-provider")
public interface RedisRemoteService {

    // 设置值，不设置过期时间
    @GetMapping("/set/redis/key/value/remote")
    ResultEntity<String> setRedisKeyValueRemote(@RequestParam("key")String key,
                                                @RequestParam("value")String value);

    // 设置值，设置过期时间
    @GetMapping("/set/redis/key/value/remote/timeout")
    ResultEntity<String> setRedisKeyValueRemoteWithTimeOut(@RequestParam("key")String key,
                                                           @RequestParam("value")String value,
                                                           @RequestParam("time")Long time );
    // 得到键值
    @RequestMapping("/get/redis/string/value/by/key")
    ResultEntity<String> getRedisStringValueByKeyRemote(@RequestParam("key") String key);

    // 删除键
    @GetMapping("/remote/redis/key/remote")
    ResultEntity<String> removeRedisKeyRemote(@RequestParam("key")String key);
}
